<?php
	//课程
	function selectCouInformation(){
		$conn = mysqli_connect("localhost:3306","mebin","171110301cwb","SMS");
		$sql = 	" select " .
				" 	coursename,tname,tid " .
				" from " .
				" 	course c left join teacher t " .
				" 	on c.course_tid = t.tid " .
				" where	t.tattr = 'ele' ";
		$result = mysqli_query($conn, $sql);
		$courses = [];
		while($rows = mysqli_fetch_assoc($result)){
			$courses[] = $rows;
		}
		mysqli_close($conn);
		return $courses;
	}
	
	function selectCouInformationBypul(){
		$conn = mysqli_connect("localhost:3306","mebin","171110301cwb","SMS");
		$sql = 	" select " .
				" 	coursename,tname,tid " .
				" from " .
				" 	course c left join teacher t " .
				" 	on c.course_tid = t.tid " .
				" where	t.tattr = 'pul' ";
		$result = mysqli_query($conn, $sql);
		$courses = [];
		while($rows = mysqli_fetch_assoc($result)){
			$courses[] = $rows;
		}
		mysqli_close($conn);
		return $courses;
	}
	
	function selectCouInformationByspe(){
		$conn = mysqli_connect("localhost:3306","mebin","171110301cwb","SMS");
		$sql = 	" select " .
				" 	coursename,tname,tid " .
				" from " .
				" 	course c left join teacher t " .
				" 	on c.course_tid = t.tid " .
				" where	t.tattr = 'spe' ";
		$result = mysqli_query($conn, $sql);
		$courses = [];
		while($rows = mysqli_fetch_assoc($result)){
			$courses[] = $rows;
		}
		mysqli_close($conn);
		return $courses;
	}
?>